package cn.com.dycc.common.controller;

import java.io.IOException;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.dycc.sys_manage.usersysmanagement.service.UserNotFoundException;
import cn.com.dycc.util.JsonObjectResult;
import cn.com.dycc.util.JsonResult;

//公共异常处理类
@Controller
public abstract class BaseController {
	

	public BaseController() {
		super();
	}
	
	
	@ExceptionHandler(Exception.class)
	@ResponseBody
	public JsonObjectResult exceptionHandler(Exception e){
		e.printStackTrace();
		return new JsonObjectResult(e);
	}
	
	
	@ExceptionHandler(UserNotFoundException.class)
	@ResponseBody
	public JsonObjectResult userExceptoin(UserNotFoundException e) {
		e.printStackTrace();
		return new JsonObjectResult(6,e);
	}
	
	@ExceptionHandler(IOException.class)
	@ResponseBody
	public JsonObjectResult ioExceptoin(IOException e) {
		e.printStackTrace();
		return new JsonObjectResult(13,e);
	}
	
	
}
